# Maintainer: Peter Budai <peterbudai@hotmail.com>

_realname=notebook
pkgbase=mingw-w64-python-jupyter_${_realname}
pkgname=${MINGW_PACKAGE_PREFIX}-python-jupyter_${_realname}
pkgver=7.4.2
pkgrel=1
pkgdesc='Jupyter Interactive Notebook (mingw-w64)'
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
msys2_references=(
  'archlinux: jupyter-notebook'
  "cpe: cpe:/a:jupyter:notebook"
  'purl: pkg:pypi/notebook'
)
msys2_repository_url='https://github.com/jupyter/notebook/'
msys2_documentation_url='https://jupyter-notebook.readthedocs.io/'
url='https://jupyter.org/'
license=('spdx:BSD-3-Clause')
depends=("${MINGW_PACKAGE_PREFIX}-python"
         "${MINGW_PACKAGE_PREFIX}-python-jupyter_server"
         "${MINGW_PACKAGE_PREFIX}-python-jupyterlab"
         "${MINGW_PACKAGE_PREFIX}-python-jupyterlab-server"
         "${MINGW_PACKAGE_PREFIX}-python-jupyter_notebook_shim"
         "${MINGW_PACKAGE_PREFIX}-python-tornado")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-build"
             "${MINGW_PACKAGE_PREFIX}-python-hatch-jupyter-builder"
             "${MINGW_PACKAGE_PREFIX}-python-installer")
options=('!strip')
source=("https://pypi.org/packages/source/${_realname::1}/${_realname}/${_realname}-${pkgver}.tar.gz")
sha256sums=('e739defd28c3f615a6bfb0a2564bd75018a9cc6613aa00bbd9c15e68eed2de1b')

build() {
  cp -r "${_realname}-${pkgver}" "python-build-${MSYSTEM}" && cd "python-build-${MSYSTEM}"
  ${MINGW_PREFIX}/bin/python -m build --wheel --skip-dependency-check --no-isolation
}

package() {
  cd "${srcdir}/python-build-${MSYSTEM}"

  MSYS2_ARG_CONV_EXCL="--prefix=" \
    ${MINGW_PREFIX}/bin/python -m installer --prefix=${MINGW_PREFIX} \
    --destdir="${pkgdir}" dist/*.whl

  install -Dm644 "LICENSE" "${pkgdir}${MINGW_PREFIX}/share/licenses/python-jupyter_${_realname}/LICENSE"

  rm -f "${pkgdir}"${MINGW_PREFIX}/bin/*.manifest
}
